import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
import { ManualTimestamp } from "../decorators/manual-timestamp.decorator";

@Entity("vip_reward_config")
@ManualTimestamp()
export class VipRewardConfigEntity {
  @PrimaryGeneratedColumn()
  id!: number;

  @Column("int", { name: "vip_level", comment: "VIP 等级(0-9)" })
  vipLevel!: number;

  @Column("tinyint", {
    name: "type",
    comment: "奖励类型: 0=特权说明 1=物品 2=经验 3=宝石 4=副将",
  })
  type!: number;

  @Column("varchar", { length: 200, comment: "标题/说明(用于前端展示)" })
  title!: string;

  @Column("tinyint", { default: 0, comment: "是否可选择(用于前端choose渲染)" })
  choose!: number;

  @Column("int", { name: "item_id", nullable: true, comment: "物品ID(type=1)" })
  itemId!: number | null;

  @Column("int", { name: "quantity", default: 1, comment: "数量(物品/宝石)" })
  quantity!: number;

  @Column("int", { name: "exp_amount", nullable: true, comment: "经验数(type=2)" })
  expAmount!: number | null;

  @Column("int", { name: "gem_level", nullable: true, comment: "宝石等级(type=3)" })
  gemLevel!: number | null;

  @Column("int", { name: "deputy_star", nullable: true, comment: "副将品质: 1国士 2将才 3英才 (type=4)" })
  deputyStar!: number | null;

  @Column("int", { name: "deputy_level", nullable: true, comment: "副将等级(默认0)", default: 0 })
  deputyLevel!: number | null;

  @Column("int", { name: "sort_order", default: 0, comment: "显示顺序" })
  sortOrder!: number;

  @Column("tinyint", { default: 1, comment: "状态：1启用 0禁用" })
  status!: number;

  @Column("datetime", { name: "created_at", comment: "创建时间" })
  created_at!: Date;

  @Column("datetime", { name: "updated_at", nullable: true, comment: "更新时间" })
  updated_at!: Date | null;
}


